export function chunkArray(arr: any[] = [], chunkSize = 200) {
  const result = [];
  const len = arr.length;

  // 循环分块
  for (let i = 0; i < len; i += chunkSize) {
    result.push(arr.slice(i, i + chunkSize));
  }

  return result;
}

export function sendMessage<T>(message: any): Promise<T> {
  return new Promise((resolve) => {
    chrome.runtime.sendMessage(message, resolve);
  });
}